package com.edu.exam.enums.grading;

/**
 * 配置类型枚举
 */
public enum ConfigType {
    STRING("STRING", "字符串"),
    INTEGER("INTEGER", "整数"),
    BOOLEAN("BOOLEAN", "布尔值"),
    DOUBLE("DOUBLE", "小数"),
    JSON("JSON", "JSON对象"),
    ARRAY("ARRAY", "数组");

    private final String code;
    private final String description;

    ConfigType(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ConfigType fromCode(String code) {
        for (ConfigType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return STRING; // 默认返回字符串
    }
}